import DHTML from "../../dhtml/index"
const {AudioContext,fetch} = DHTML
Page({
  onLoad(){
    this.body_load().then()
  },
  async body_load(){
 return
const aCtx = new AudioContext(); 
 

 
const gainNode = aCtx.createGain(); 
 
gainNode.gain.value = 0.1; // setting it to 10% 
 
gainNode.connect(aCtx.destination); 
 

 
let source = aCtx.createBufferSource(); 
 
let buf; 
 
fetch('/sounds/bounce.wav') // can be XHR as well 
 
    .then(resp => resp.arrayBuffer()) 
 
    .then(buf => aCtx.decodeAudioData(buf)) // can be callback as well 
 
    .then(decoded => { 
 
    source.buffer = buf = decoded; 
 
    source.loop = true; 
 
    source.connect(gainNode); 
 

 
    }); 
 

 
    source.start(0); // start our bufferSource 
 
 
  }
})
